package STUDENT.TRANNGUYENQUAN.OOPs.OBJECT_AND_CLASSES.Square;

import java.util.Scanner;

public class Views {

	public static void main(String[] args) {
		String str = "";
		Square squ = new Square();
		Models model = new Models();
		SquareControllers controller = new SquareControllers();
		Scanner sc;
		do{
			System.out.println("Nhap vao gia tri 1 canh cua hinh vuong: ");
			sc = new Scanner(System.in);
			String temp = sc.nextLine();
			if(temp.isEmpty()){
				System.out.println("Ban chua nhap gia tri 1 canh cua hinh vuong!");
			}else{
				str = temp;
			}
		}while(str.isEmpty());
		squ.setSide(Double.parseDouble(str));
		if(controller.Check(squ)){
			System.out.println("Dien tich cua hinh vuong la: "+model.Area(squ));
			System.out.println("Chu vi cua hinh vuong la: "+model.Perimeter(squ));
		}else{
			System.out.println("Ban nhap chua dung gia tri canh cua hinh vuong, gia tri cua canh phai lon hon hoac bang 1!");
		}
	}

}
